package com.wrh.draw;

import java.awt.*;

/**
 * @author wrh
 */
public class Graphics2DStyle {

    private Color color;

    private Stroke stroke;

    private Font font;

    public void setStyle(Graphics2D g) {
        if (this.color != null) {
            g.setColor(this.color);
        }

        if (this.stroke != null) {
            g.setStroke(this.stroke);
        }

        if (this.font != null) {
            g.setFont(this.font);
        }
    }

    public Color getColor() {
        return color;
    }

    public Graphics2DStyle setColor(Color color) {
        this.color = color;
        return this;
    }

    public Stroke getStroke() {
        return stroke;
    }

    public Graphics2DStyle setStroke(Stroke stroke) {
        this.stroke = stroke;
        return this;
    }

    public Graphics2DStyle setStroke(BasicStroke basicStroke) {
        this.stroke = basicStroke;
        return this;
    }

    public Graphics2DStyle setStroke(int strokeWidth) {
        this.stroke = new BasicStroke(strokeWidth);
        return this;
    }

    public Font getFont() {
        return font;
    }

    public Graphics2DStyle setFont(Font font) {
        this.font = font;
        return this;
    }
}
